home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #11 / Amiga Plus CD - 2004 - No. 11.iso / AmiSoft / Dev / misc / iff-rgfx.lha / IFF-RGFX / rgfx.h < prev    next >
C/C++ Source or Header  |  2004-08-29  |  9KB  |  274 lines

  1. /*
  2. **      $VER: rgfx 2.0 (28.8.2004)
  3. **
  4. **      Specs and structure definitions for the IFF-RGFX file format -
  5. **
  6. **      (C) Copyright 1997-2004 Andreas R. Kleinert
  7. **      Freeware. All Rights Reserved.
  8. */
  9.  
  10. #ifndef RGFX_H
  11. #define RGFX_H
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif /* EXEC_TYPES_H */
  16.  
  17. #ifndef LIBARIES_IFFPARSE_H
  18. #include <libraries/iffparse.h>
  19. #endif /* LIBARIES_IFFPARSE_H */
  20.  
  21.  
  22. /* *************************************************** */
  23. /* *                                                 * */
  24. /* * IFF/RGFX specific definitions and declarations  * */
  25. /* *                                                 * */
  26. /* *************************************************** */
  27.  
  28. #define ID_FORM  MAKE_ID('F','O','R','M')  /* if not already defined */
  29. #define ID_RGFX  MAKE_ID('R','G','F','X')  /* IFF-RGFX               */
  30.  
  31. /* A typical structure of a RGFX file (recommended) :
  32.  
  33.      FORM-RGFX
  34.  
  35.        RGHD
  36.        RSCM
  37.        RCOL
  38.        RBOD
  39. */
  40.  
  41.  
  42. /*******************************************************
  43.    RGHD - RawGfx Bitmap Header (mandatory)
  44.  
  45.    ** This one replaces BMHD
  46.  
  47. */
  48.  
  49. #define ID_RGHD  MAKE_ID('R','G','H','D')
  50.  
  51. struct RGHD
  52. {
  53.  ULONG rgfx_LeftEdge;     /* (see BMHD)                               */
  54.  ULONG rgfx_TopEdge;      /* (see BMHD)                               */
  55.  ULONG rgfx_Width;        /* (see BMHD)                               */
  56.  ULONG rgfx_Height;       /* (see BMHD)                               */
  57.  ULONG rgfx_PageWidth;    /* (see BMHD)                               */
  58.  ULONG rgfx_PageHeight;   /* (see BMHD)                               */
  59.  
  60.  ULONG rgfx_Depth;        /* 1-8         for RMBT_BYTEPLANAR8,
  61.                              1-8         for RMBT_BYTECHUNKY8,
  62.                               15         for RMBT_2BYTERGB15
  63.                               15         for RMBT_2BYTERGB16
  64.                               24         for RMBT_3BYTERGB24
  65.                               24         for RMBT_4BYTERGB32          */
  66.  ULONG rgfx_PixelBits;    /* 1-8         for RMBT_BYTEPLANAR8,
  67.                                8         for RMBT_BYTECHUNKY8,
  68.                               15         for RMBT_2BYTERGB15
  69.                               16         for RMBT_2BYTERGB16
  70.                               24         for RMBT_3BYTERGB24
  71.                               32         for RMBT_4BYTERGB32          */
  72.  ULONG rgfx_BytesPerLine; /* (width+7)/8 for RMBT_BYTEPLANAR8,
  73.                               width      for RMBT_BYTECHUNKY8,
  74.                               width*2    for RMBT_2BYTERGB15
  75.                               width*2    for RMBT_2BYTERGB16
  76.                               width*3    for RMBT_3BYTERGB24
  77.                               width*4    for RMBT_4BYTERGB32          */
  78.  
  79.  ULONG rgfx_Compression;  /* RCMP_ type flag                          */
  80.  ULONG rgfx_XAspect;      /* (see BMHD)                               */
  81.  ULONG rgfx_YAspect;      /* (see BMHD)                               */
  82.  ULONG rgfx_BitMapType;   /* RBMT_ type flag                          */
  83. };
  84.  
  85.  /* if you encounter unknown depth/pixelbits/bytesperline combinations,
  86.     then do reject these (future expansions).
  87.   */
  88.  
  89. #define RCMT_NOCOMPRESSION  (0L)
  90. #define RCMT_XPK            (1L)
  91.  
  92. #define RMBT_BYTEPLANAR8    (0L)     /* unaligned planar 8 bit bitmap  */
  93. #define RMBT_BYTECHUNKY8    (1<<0L)  /* unaligned chunky 8 bit bitmap  */
  94. #define RMBT_3BYTERGB24     (1<<1L)  /* 3-byte 24 bit RGB triples      */
  95. #define RMBT_4BYTERGB32     (1<<2L)  /* 4-byte 32 bit ARGB quadruples  */
  96. #define RMBT_2BYTERGB15     (1<<4L)  /* 2-byte 15 bit  RGB (x+3x5 bit) */
  97. #define RMBT_2BYTERGB16     (1<<5L)  /* 2-byte 16 bit ARGB (1+3x5 bit) */
  98.  
  99. #define RMBT_6BYTERGB48     (1<<6L)  /* 6-byte 48 bit  RGB (3x 16 bit) */
  100. #define RMBT_8BYTERGB64     (1<<7L)  /* 8-byte 64 bit ARGB (4x 16 bit) */
  101.  
  102. #define RMBT_HAS_ALPHA      (1<<31L) /* is the A in ARGB really used?  */
  103.  
  104. /* Meaning of "A" (alpha information):
  105.  
  106.    Definition is the same as in PNG:
  107.    0 means fully opaque and 1 (1 bit alpha) or 255 (8-bit alpha)
  108.    means fully transparent.
  109. */
  110.  
  111. /* ***************************************************** */
  112.  
  113.  
  114. /*******************************************************
  115.    RGXY - RawGfx Aspect Info (optional)
  116.  
  117.    ** This one replaces BMHD's XAspect/YAspect
  118.  
  119. */
  120.  
  121. #define ID_RGXY  MAKE_ID('R','G','X','Y')
  122.  
  123. struct RGXY
  124. {
  125.  ULONG  rgfx_XAspect;      /* (see BMHD)                               */
  126.  ULONG  rgfx_YAspect;      /* (see BMHD)                               */
  127.  ULONG  rgfx_HasDouble;    /* does a valid number follow? (TRUE/FALSE) */
  128.  DOUBLE rgfx_XYRatio;      /* := x/y, IEEE754 (mathieedoubbas)         */
  129.   LONG  rgfx_VGAMode;      /* see below                                */
  130. };
  131.  
  132. /* as VGA mode, you can specifiy a Linux VGA mode, like
  133.    "788" (800x600, 16 bit color) to simplify the viewmode
  134.    selection. Negative values are reserved or defined as below:
  135. */
  136.  
  137. #define RGFX_VGAMODE_DEFAULT        (0L)  /* do not use!     */
  138.  
  139. #define RGFX_VGAMODE_INVALID        (-1L) /* use, if default */
  140. #define RGFX_VGAMODE_AMIGAVIEW_MODE RGFX_VGAMODE_INVALID
  141.  
  142. #define RGFX_VGAMODE_PAL       (-2L)      /*  720x576        */
  143. #define RGFX_VGAMODE_NTSC      (-3L)      /*  720x480        */
  144. #define RGFX_VGAMODE_HDTV_720  (-4L)      /*  720x1280       */
  145. #define RGFX_VGAMODE_HDTV_1080 (-5L)      /* 1080x1920       */
  146. #define RGFX_VGAMODE_HDTV_1125 (-6L)      /*                 */
  147. #define RGFX_VGAMODE_HDTV_1250 (-7L)      /*                 */
  148.  
  149. /*******************************************************/
  150.  
  151.  
  152. /*******************************************************
  153.    RSCM - RawGfx ScreenMode (mandatory, processing optional)
  154.  
  155.    ** This one replaces CAMG.
  156.  
  157.    The default setting is:
  158.  
  159.    rscm_ViewMode: default screenmode
  160.    rscm_OBSOLETE: INVALID_ID
  161.    rscm_OBSOLETE: INVALID_ID
  162.  
  163.  
  164.    Note: Since HAM modes only can be identified by their
  165.          ID, you should make sure, that the ViewMode contains
  166.          HAM_KEY. The same for EHB and EXTRAHALFBRITE_KEY.
  167.  
  168.          Specific RTG ViewModes will lose their meaning,
  169.          as soon as graphics are transferred between different
  170.          systems. 
  171.  
  172.          Always set the OBSOLETE entries to 0xFFFFFFFF;
  173. */
  174.  
  175. #define ID_RSCM  MAKE_ID('R','S','C','M')
  176.  
  177. struct RSCM
  178. {
  179.  ULONG rscm_ViewMode;  /* 32 Bit AGA Viewmode ID  */
  180.  ULONG rscm_OBSOLETE0; /* no longer supported     */
  181.  ULONG rscm_OBSOLETE1; /* no longer supported     */
  182. };
  183. /* ***************************************************** */
  184.  
  185.  
  186. /*******************************************************
  187.    RCOL - RawGfx Colormap (optional for > 8 bit)
  188.  
  189.    ** This one replaces CMAP,
  190.  
  191.       Required with RMBT_BYTEPLANAR8 and RMBT_BYTECHUNKY8,
  192.       and optionally allowed for the other modes as a
  193.       recommended dithering destination colormap.
  194.  
  195.       Stored are 256 byte triples in RGB format. Note, that
  196.       full-range values (0..255) have to be stored.
  197.  
  198.       Sample:   rcol_Colors[0][0]   = 0..255 red   value, color #0 (1st)
  199.                 rcol_Colors[0][1]   = 0..255 green value, color #0
  200.                 rcol_Colors[0][2]   = 0..255 blue  value, color #0
  201.                 ...
  202.                 rcol_Colors[255][0] = 0..255 red   value, color #255 (256th)
  203.                 rcol_Colors[255][1] = 0..255 green value, color #255
  204.                 rcol_Colors[255][2] = 0..255 blue  value, color #255
  205.  
  206.  
  207.       Unused entries must be filled with zeroes.
  208.  
  209.  
  210.    Allowed boolean values for "rcol_TransColor":  TRUE (1L) and FALSE (0L)
  211.  
  212.    Note: With EHB mode, which e.g. uses 64 colors with only a 32 color
  213.          palette, you always should store the full color range within
  214.          the RCOL structure: if someone is going to display EHB pictures
  215.          on an RTG screen, he won't have to calculate the 'missing'
  216.          colors by himself.
  217.  
  218.   Note:  In case dithering of 16/32 bit graphics is done, the alpha
  219.          information gets lost! In this case, the transparent color
  220.          from below can be used. For example, if the transparent
  221.          color was BLACK (0,0,0) the effect surely will be the same.
  222. */
  223.  
  224. #define ID_RCOL  MAKE_ID('R','C','O','L')
  225.  
  226. struct RCOL
  227. {
  228.  ULONG rcol_TransColor;      /* boolean: is there a transparent color ?  */
  229.  ULONG rcol_TransColorNum;   /* yes, it's number ... from the ones below */
  230.  UBYTE rcol_Colors[256][3];
  231. };
  232. /* ***************************************************** */
  233.  
  234.  
  235. /*******************************************************
  236.    RBOD - RawGfx Bitmap Body (mandatory)
  237. w
  238.    ** This one replaces BODY
  239. */
  240.  
  241. #define ID_RBOD  MAKE_ID('R','B','O','D')
  242.  
  243. /* May look like:
  244.  
  245. struct RBOD
  246. {
  247.  UBYTE rbod_XPK[3];     ** containing 'XPK'
  248.  UBYTE rbod_BitMap[];
  249. };
  250.  
  251.    Or simply:
  252.  
  253. struct RBOD
  254. {
  255.  UBYTE rbod_BitMap[];
  256. };
  257.  
  258.  This has not been defined as a union structure here, since some
  259.  compilers might add unwished pad bytes to the structure.
  260.  
  261.  You should reference this chunk as an UBYTE array, only.
  262.  
  263.  ******************************************************* */
  264.  
  265.  
  266. /*******************************************************
  267.    RGFX - Other chunks
  268.  
  269.    - NAME, AUTH, ANNO and (C) chunks are allowed
  270.  
  271. ******************************************************** */
  272.  
  273. #endif /* RGFX_H */
  274.